home *** CD-ROM | disk | FTP | other *** search
- Path: news.unt.edu!news
- From: Steve Fogoros <sfogoros@hsc.unt.edu>
- Newsgroups: comp.lang.c
- Subject: Re: Keyboard lights.
- Date: Tue, 27 Feb 1996 20:00:26 -0800
- Organization: University of North Texas Health Science Center
- Message-ID: <3133D35A.2947@hsc.unt.edu>
- References: <4gvi6u$7qf@bertrand.ccs.carleton.ca>
- NNTP-Posting-Host: sfogoros.hsc.unt.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (Win16; I)
-
- Evan Hughes wrote:
- >
- > Where is the status byte for the ...
-
- Hope you don't mind I sent the whole thing:
-
- /* setlocks.c - program for setting num, caps, scroll lock keys */
- /* assumes PC/DOS type computer
-
- #include "dos.h"
- #include "stdio.h"
- #include "string.h"
- #include "stdlib.h"
-
- #define LOCKADDR_SEG 0x0040
- #define LOCKADDR_OFF 0x0017
-
- main(int argc, char *argv[])
- {
- char c, status[80];
-
- c = peekb(LOCKADDR_SEG,LOCKADDR_OFF);
-
- if(argc != 3 || argv[1][0] == '-')
- {
- status[0] = 0;
- if(c & 0x20) strcat(status,"Num on, "); else strcat(status,"Num off, ");
- if(c & 0x40) strcat(status,"Cap on, "); else strcat(status,"Cap off, ");
- if(c & 0x10) strcat(status,"Scr on, "); else strcat(status,"Scr off, ");
- if(c & 0x80) strcat(status,"Ins on"); else strcat(status,"Ins off");
- prthelp(status);
- }
-
- strlwr(argv[1]);
- strlwr(argv[2]);
-
- switch(argv[1][0])
- {
- case 'n': if(argv[2][1] == 'n') c = c | 0x20; else c = c & 0xdf; break;
- case 'c': if(argv[2][1] == 'n') c = c | 0x40; else c = c & 0xbf; break;
- case 's': if(argv[2][1] == 'n') c = c | 0x10; else c = c & 0xef; break;
- case 'i': if(argv[2][1] == 'n') c = c | 0x80; else c = c & 0x7f; break;
- }
-
- pokeb(LOCKADDR_SEG,LOCKADDR_OFF,c);
- }
-
- prthelp(char *status)
- {
- printf("\nusage: setlocks [ [num on|off] [cap on|off] [scr on|off] [ins on|off] ]\n\n");
- printf("setlocks is used to set or reset the named keyboard lock. Handy when used\n");
- printf("in a batch file. Only one lock may be changed at a time.\n\n");
- printf("ex. setlocks n on\n");
- printf(" setlocks ca off\n");
- printf(" setlocks ins on\n\n");
- printf("Only the first char is looked at to tell which lock has been selected.\n");
- printf("Only the second char of command is looked at to tell on or off.\n\n");
- printf("Actual settings are %s\n",status);
- exit(0);
- }
- --
- Steve Fogoros, Academic Information Coordinator
- University of North Texas Health Science Center
- 3500 Camp Bowie Boulevard, Fort Worth, Texas 76107-2699
- (817)-735-2162 sfogoros@hsc.unt.edu
-